﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data;
using System.Data.SqlClient;
using DataAccessClasses;

namespace mobliebo
{
  public  class smartphone_info
    {
      iDAC DAC = DACFactory.GetDAC();
      private long _phone_id = -99;
      private string _name = "";
      private string _model = "";
      private long _company_id = -99;
      private string _manufacture_date="1/1/1800";
      private long _MRP=-99;
      private long _IEMI_no=-99;
      private long _launched_year=1800;
      private string _market_reputation="";
      private long _warranty=-99;
      private string _other_features="";
      private string _bluetooth="";
      private string _wifi_infrared="";
      private string _three_g_status="";
      private bool _is_deleted=false;

      public bool is_deleted
      {
          get
          {
              return _is_deleted;
          }
          set
          {
              _is_deleted=value;
          }
      }
         public long phone_id
      {
          get
          {
              return _phone_id;
          }
          set
          {
              _phone_id=value;
          }
      } 
          
      public string name
      {
          get
          {
              return  _name;
          }
          set
          {
              _name=value;
          }
      }
      public string model
      {
          get
          {
              return _model;
          }
          set
          {
              _model=value;
          }
      }
      public long company_id
      {
          get
          {
              return _company_id;
          }
          set
          {
             _company_id=value;
          }
      }
      public string manufacture_date
      {
          get
          {
              return _manufacture_date;
          }
          set
          {
              _manufacture_date=value;
          }
      }
      public long MRP
      {
          get
          {
              return _MRP;
          }
          set
          {
              _MRP=value;
          }
      }
      public long IEMI_no
      {
          get
          {
              return _IEMI_no;
          }
          set
          {
              _IEMI_no=value;
          }
      }
      public long launched_year
      {
          get
          {
              return _launched_year;
          }
          set
          {
              _launched_year=value;
          }
      }public string market_reputation
      {
          get
          {
              return _market_reputation;
          }
          set
          {
              _market_reputation=value;
          }
      }public long warranty
      {
          get
          {
              return _warranty;
          }
          set
          {
             _warranty=value;
          }
      }public string other_features
      {
          get
          {
              return _other_features;
          }
          set
          {
              _other_features=value;
          }
      }public string bluetooth
      {
          get
          {
              return _bluetooth;
          }
          set
          {
              _bluetooth=value;
          }
      }public string wifi_infrared
      {
          get
          {
              return _wifi_infrared;
          }
          set
          {
              _wifi_infrared=value;
          }
      }
    
    public string three_g_status
      {
          get
          {
              return _three_g_status;
          }
          set
          {
              _three_g_status=value;
          }
      }
      public long SaveRecords()
      {
          try
          {
             

              DbParameter dbparam0 = DAC.Parameter("@phone_id", phone_id, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam1 = DAC.Parameter("@name", name, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam2 = DAC.Parameter("@model", model, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam3 = DAC.Parameter("@company_id", company_id, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam4 = DAC.Parameter("@manufacture_date", manufacture_date, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam5 = DAC.Parameter("@MRP", MRP, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam6 = DAC.Parameter("@IEMI_no", IEMI_no, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam7 = DAC.Parameter("@launched_year", launched_year, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam8 = DAC.Parameter("@market_reputation", market_reputation, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam9 = DAC.Parameter("@warranty", warranty, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam10 = DAC.Parameter("@other_features", other_features, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam11 = DAC.Parameter("@bluetooth", bluetooth, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam12 = DAC.Parameter("@wifi_infrared", wifi_infrared, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam13 = DAC.Parameter("@three_g_status", three_g_status, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam14 = DAC.Parameter("@is_deleted", is_deleted, DbType.Boolean, ParameterDirection.Input);
              DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11, dbparam12, dbparam13, dbparam14 };
              return DAC.Save("smartphone_info_save", dbparamcall);
          }
          catch (Exception ex)
          {
              long Result = -99;
          }
          return -99;
          }
      public DataTable GetRcords(long phone_id,string name,string model,long company_id,string manufacture_date,long MRP,long IEMI_no, long launched_year,string market_reputation, long warranty,string other_features,string bluetooth,string wifi_infrared,string three_g_status, bool is_deleted, string andor)
      {
          try
          {
               DbParameter dbparam0 = DAC.Parameter("@phone_id", phone_id, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam1 = DAC.Parameter("@name", name, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam2 = DAC.Parameter("@model", model, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam3 = DAC.Parameter("@company_id", company_id, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam4 = DAC.Parameter("@manufacture_date", manufacture_date, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam5 = DAC.Parameter("@MRP", MRP, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam6 = DAC.Parameter("@IEMI_no", IEMI_no, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam7 = DAC.Parameter("@launched_year", launched_year, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam8 = DAC.Parameter("@market_reputation", market_reputation, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam9 = DAC.Parameter("@warranty", warranty, DbType.Int64, ParameterDirection.Input);
              DbParameter dbparam10 = DAC.Parameter("@other_features", other_features, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam11 = DAC.Parameter("@bluetooth", bluetooth, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam12 = DAC.Parameter("@wifi_infrared", wifi_infrared, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam13 = DAC.Parameter("@three_g_status", three_g_status, DbType.AnsiString, ParameterDirection.Input);
              DbParameter dbparam14 = DAC.Parameter("@is_deleted", is_deleted, DbType.Boolean, ParameterDirection.Input);
               DbParameter dbparam15 = DAC.Parameter("@andor", andor, DbType.AnsiString, ParameterDirection.Input);

              DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11, dbparam12, dbparam13, dbparam14,dbparam15 };
              return DAC.Select("smartphone_info_get", dbparamcall);
              DataTable dt1=DAC.Select("smartphone_info_get",dbparamcall);
              return dt1;

          }
          catch (Exception ex)
          {
              long Result = -99;
          }
          return null;
          }
                  
          }
}



